package cn.lg.soar.flow.api.model.node;

import cn.lg.soar.flow.api.enums.NodeStatusEnum;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        include = JsonTypeInfo.As.EXISTING_PROPERTY,
        property = "type",
        visible = true
)
@JsonSubTypes({
        @JsonSubTypes.Type(value = StartNode.class, name = "start"),
        @JsonSubTypes.Type(value = ApprovalNode.class, name = "approval"),
        @JsonSubTypes.Type(value = TaskNode.class, name = "carbon-copy"),
        @JsonSubTypes.Type(value = TaskNode.class, name = "notify"),
        @JsonSubTypes.Type(value = ServiceNode.class, name = "service"),
        @JsonSubTypes.Type(value = TimerNode.class, name = "timer"),
        @JsonSubTypes.Type(value = EndNode.class, name = "end"),
        @JsonSubTypes.Type(value = ExclusiveGateway.class, name = "exclusive-gateway")
})
public interface Node {

    String getType();
    default void setType(String type) {}

    String getKey();
    void setKey(String key);

    String getName();
    void setName(String name);

    String getDescription();
    void setDescription(String description);

    NodeStatusEnum getStatus();
    void setStatus(NodeStatusEnum status);


    default String inKey() {
        return getKey();
    }

    default String outKey() {
        return getKey();
    }

    String toXmlString();

}